# Install packages required for the analysis (uncomment if needed)
#install.packages("lmtest") ; install.packages("Epi")
#install.packages("tsModel"); install.packages("vcd")
# load the packages
library(foreign)
library(tsModel)
library(lmtest)
library(Epi)
library(splines)
library(vcd)
library(pander)
library(dplyr)
library(ggplot2)
library(cowplot)stringency.df <- read.csv(url("https://raw.githubusercontent.com/OxCGRT/covid-policy-tracker/master/data/OxCGRT_latest.csv"), na.strings = c("", "NA"), header = TRUE)
stringency.df$Date <- as.factor(stringency.df$Date) %>% as.Date(stringency.df$Date, format = "%Y%m%d")
stringency.df.filtered <- stringency.df %>%
select(Country_Name = 1, Date = 6, Stringency_Index = 42) %>% #Renamed variables and filtered to keep only those of interest.
filter(Date >= "2020-01-23" & Date <= "2020-05-31") #Filtered out all but most recent date (most recent date is a running sum of total cases).
stringency.df.filtered <- aggregate(Stringency_Index ~ Country_Name, stringency.df.filtered, mean) %>% arrange(desc(Stringency_Index))NO2.df.filter.fxn <- function(location, type) {
weekly.df <- read.csv(file = paste0("time_series_csv/", location, ".", type, ".weekly.NO2.csv"))
weekly.df$Date <- as.Date(weekly.df$Date)
weekly.df$Period <- as.factor(weekly.df$Period)
weekly.df
}
ITS.plot.fxn <- function(df, location, date.start, date.lockdown.start, date.lockdown.end, date.end) {
ggplot(df, aes(x = Date, y = NO2_Concentration, group = Period, color = Period)) +
geom_line(size = 0.75) +
theme_bw() +
theme(legend.key.size = unit(1, 'cm'),
plot.title = element_text(size=22),
legend.position="right",
legend.title = element_text(size=14),
legend.text = element_text(size=10),
axis.title=element_text(size = 10),
axis.text.y=element_text(size=10),
axis.text.x=element_text(size=10,angle=90, hjust=1)) +
labs(fill = "Year of Measured Pollution") +
ggtitle(paste(location, "NO2 in 2019 vs 2020")) +
ylab("NO2 Concentration (mol/m^2)") +
scale_x_date(date_labels = "%b",date_breaks = "1 month",expand=c(0,0),limits=c(as.Date(date.start,format="%Y-%m-%d"),as.Date(date.end,format="%Y-%m-%d"))) +
ylim(0, 2.4E-4) +
#Pre-lockdown
geom_rect(data=df,aes(xmin=as.Date(date.start,format="%Y-%m-%d"),xmax=as.Date(date.lockdown.start,format="%Y-%m-%d"),ymin=2.3E-4,ymax=2.4E-4),fill = "#c0c0c0",color = NA, alpha=0.02) +
geom_text(data=df,aes(x=mean.Date(as.Date(c(date.start, date.lockdown.start), format=c("%Y-%m-%d"))) ,y=2.35E-4),label="Pre-Lockdown",color = "black", size = 2) +
geom_vline(data=df,xintercept = as.Date(date.lockdown.start,format="%Y-%m-%d"),linetype="dashed",colour="black",size=0.75,alpha=0.8) +
#Lockdown 1
geom_rect(data=df,aes(xmin=as.Date(date.lockdown.start,format="%Y-%m-%d"),xmax=as.Date(date.lockdown.end,format="%Y-%m-%d"),ymin=2.3E-4,ymax=2.4E-4),fill = "#fa9796",color = NA,alpha=0.02) +
geom_text(data=df,aes(x=mean.Date(as.Date(c(date.lockdown.start, date.lockdown.end), format=c("%Y-%m-%d"))),y=2.35E-4),label="Lockdown 1", color = "black", size = 2) +
geom_vline(data=df,xintercept=as.Date(date.lockdown.end,format="%Y-%m-%d"),linetype="dashed",colour="black",size=0.75,alpha=0.8) +
#Re-opening Green PHASE
geom_rect(data=df,aes(xmin=as.Date(date.lockdown.end,format="%Y-%m-%d"),xmax=as.Date(date.end,format="%Y-%m-%d"), ymin=2.3E-4,ymax=2.4E-4),fill = "#b5dea5",color = NA,alpha=0.02) +
geom_text(data=df,aes(x=mean.Date(as.Date(c(date.lockdown.end, date.end), format=c("%Y-%m-%d"))),y=2.35E-4),label="Re-Opening", color = "black", size = 2) +
scale_alpha_manual(values = c(0.4, 1.1)) +
scale_color_manual(values = c("gray", "blue", "black"))
}#World
#world.urban.weekly.df <- NO2.df.filter.fxn("world", "urban")
#world.rural.weekly.df <- NO2.df.filter.fxn("world", "rural")
#world.urban.plot <- ITS.plot.fxn(world.urban.weekly.df, "World Urban", "2019-12-01", "2020-01-30", "2020-07-01", "2020-12-24")
#world.rural.plot <- ITS.plot.fxn(world.rural.weekly.df, "World Rural", "2019-12-01", "2020-01-30", "2020-07-01", "2020-12-24")
#world.rural.vs.urban <- plot_grid(world.urban.plot, world.rural.plot, labels = c('A', 'B'), ncol = 1)
#ggsave("World_rural_vs_urban.pdf", world.rural.vs.urban)
#world.rural.vs.urban
#Czechia
czechia.urban.weekly.df <- NO2.df.filter.fxn("czechia", "urban")
czechia.rural.weekly.df <- NO2.df.filter.fxn("czechia", "rural")
czechia.urban.plot <- ITS.plot.fxn(czechia.urban.weekly.df, "Czechia Urban", "2019-12-01", "2020-03-16", "2020-04-12", "2020-12-24")
czechia.rural.plot <- ITS.plot.fxn(czechia.rural.weekly.df, "Czechia Rural", "2019-12-01", "2020-03-16", "2020-04-12", "2020-12-24")
czechia.rural.vs.urban <- plot_grid(czechia.urban.plot, czechia.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Czechia_rural_vs_urban.pdf", czechia.rural.vs.urban)
czechia.rural.vs.urban #Slovenia
slovenia.urban.weekly.df <- NO2.df.filter.fxn("slovenia", "urban")
slovenia.rural.weekly.df <- NO2.df.filter.fxn("slovenia", "rural")
slovenia.urban.plot <- ITS.plot.fxn(slovenia.urban.weekly.df, "Slovenia Urban", "2019-12-01", "2020-03-16", "2020-05-15", "2020-12-24")
slovenia.rural.plot <- ITS.plot.fxn(slovenia.rural.weekly.df, "Slovenia Rural", "2019-12-01", "2020-03-16", "2020-05-15", "2020-12-24")
slovenia.rural.vs.urban <- plot_grid(slovenia.urban.plot, slovenia.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Slovenia_rural_vs_urban.pdf", slovenia.rural.vs.urban)
slovenia.rural.vs.urban #Sweden
sweden.urban.weekly.df <- NO2.df.filter.fxn("sweden", "urban")
sweden.rural.weekly.df <- NO2.df.filter.fxn("sweden", "rural")
sweden.urban.plot <- ITS.plot.fxn(sweden.urban.weekly.df, "Sweden Urban", "2019-12-01", "2020-03-16", "2020-05-15", "2020-12-24") #No real lockdown end date, use May 15 as arbitrart date.
sweden.rural.plot <- ITS.plot.fxn(sweden.rural.weekly.df, "Sweden Rural", "2019-12-01", "2020-03-16", "2020-05-15", "2020-12-24")
sweden.rural.vs.urban <- plot_grid(sweden.urban.plot, sweden.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Sweden_rural_vs_urban.pdf", sweden.rural.vs.urban)
sweden.rural.vs.urban #Uruguay
uruguay.urban.weekly.df <- NO2.df.filter.fxn("uruguay", "urban")
uruguay.rural.weekly.df <- NO2.df.filter.fxn("uruguay", "rural")
uruguay.urban.plot <- ITS.plot.fxn(uruguay.urban.weekly.df, "Uruguay Urban", "2019-12-01", "2020-03-13", "2020-05-04", "2020-12-24")
uruguay.rural.plot <- ITS.plot.fxn(uruguay.rural.weekly.df, "Uruguay Rural", "2019-12-01", "2020-03-13", "2020-05-04", "2020-12-24")
uruguay.rural.vs.urban <- plot_grid(uruguay.urban.plot, uruguay.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Uruguay_rural_vs_urban.pdf", uruguay.rural.vs.urban)
uruguay.rural.vs.urban #Lithuania
lithuania.urban.weekly.df <- NO2.df.filter.fxn("lithuania", "urban")
lithuania.rural.weekly.df <- NO2.df.filter.fxn("lithuania", "rural")
lithuania.urban.plot <- ITS.plot.fxn(lithuania.urban.weekly.df, "Lithuania Urban", "2019-12-01", "2020-03-16", "2020-06-18", "2020-12-24")
lithuania.rural.plot <- ITS.plot.fxn(lithuania.rural.weekly.df, "Lithuania Rural", "2019-12-01", "2020-03-16", "2020-06-18", "2020-12-24")
lithuania.rural.vs.urban <- plot_grid(lithuania.urban.plot, lithuania.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Lithuania_rural_vs_urban.pdf", lithuania.rural.vs.urban)
lithuania.rural.vs.urban #U.S.
us.urban.weekly.df <- NO2.df.filter.fxn("us", "urban")
us.rural.weekly.df <- NO2.df.filter.fxn("us", "rural")
us.urban.plot <- ITS.plot.fxn(us.urban.weekly.df, "U.S. Urban", "2019-12-01", "2020-03-19", "2020-06-05", "2020-12-24")
us.rural.plot <- ITS.plot.fxn(us.rural.weekly.df, "U.S. Rural", "2019-12-01", "2020-03-19", "2020-06-05", "2020-12-24")
us.rural.vs.urban <- plot_grid(us.urban.plot, us.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("US_rural_vs_urban.pdf", us.rural.vs.urban)
us.rural.vs.urban #Netherlands
netherlands.urban.weekly.df <- NO2.df.filter.fxn("netherlands", "urban")
netherlands.rural.weekly.df <- NO2.df.filter.fxn("netherlands", "rural")
netherlands.urban.plot <- ITS.plot.fxn(netherlands.urban.weekly.df, "Netherlands Urban", "2019-12-01", "2020-03-15", "2020-04-06", "2020-12-24")
netherlands.rural.plot <- ITS.plot.fxn(netherlands.rural.weekly.df, "Netherlands Rural", "2019-12-01", "2020-03-15", "2020-04-06", "2020-12-24")
netherlands.rural.vs.urban <- plot_grid(netherlands.urban.plot, netherlands.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Netherlands_rural_vs_urban.pdf", netherlands.rural.vs.urban)
netherlands.rural.vs.urban #Estonia
estonia.urban.weekly.df <- NO2.df.filter.fxn("estonia", "urban")
estonia.rural.weekly.df <- NO2.df.filter.fxn("estonia", "rural")
estonia.urban.plot <- ITS.plot.fxn(estonia.urban.weekly.df, "Estonia Urban", "2019-12-01", "2020-03-13", "2020-05-17", "2020-12-24")
estonia.rural.plot <- ITS.plot.fxn(estonia.rural.weekly.df, "Estonia Rural", "2019-12-01", "2020-03-13", "2020-05-17", "2020-12-24")
estonia.rural.vs.urban <- plot_grid(estonia.urban.plot, estonia.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Estonia_rural_vs_urban.pdf", estonia.rural.vs.urban)
estonia.rural.vs.urban #Argentina
argentina.urban.weekly.df <- NO2.df.filter.fxn("argentina", "urban")
argentina.rural.weekly.df <- NO2.df.filter.fxn("argentina", "rural")
argentina.urban.plot <- ITS.plot.fxn(argentina.urban.weekly.df, "Argentina Urban", "2019-12-01", "2020-03-20", "2020-05-10", "2020-12-24")
argentina.rural.plot <- ITS.plot.fxn(argentina.rural.weekly.df, "Argentina Rural", "2019-12-01", "2020-03-20", "2020-05-10", "2020-12-24")
argentina.rural.vs.urban <- plot_grid(argentina.urban.plot, argentina.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Argentina_rural_vs_urban.pdf", argentina.rural.vs.urban)
argentina.rural.vs.urban #Israel
israel.urban.weekly.df <- NO2.df.filter.fxn("israel", "urban")
israel.rural.weekly.df <- NO2.df.filter.fxn("israel", "rural")
israel.urban.plot <- ITS.plot.fxn(israel.urban.weekly.df, "Israel Urban", "2019-12-01", "2020-03-20", "2020-05-10", "2020-12-24")
israel.rural.plot <- ITS.plot.fxn(israel.rural.weekly.df, "Israel Rural", "2019-12-01", "2020-03-20", "2020-05-10", "2020-12-24")
israel.rural.vs.urban <- plot_grid(israel.urban.plot, israel.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Israel_rural_vs_urban.pdf", israel.rural.vs.urban)
israel.rural.vs.urban #China
china.urban.weekly.df <- NO2.df.filter.fxn("china", "urban")
china.rural.weekly.df <- NO2.df.filter.fxn("china", "rural")
china.urban.plot <- ITS.plot.fxn(china.urban.weekly.df, "China Urban", "2019-10-31", "2020-01-23", "2020-04-08", "2020-11-01")
china.rural.plot <- ITS.plot.fxn(china.rural.weekly.df, "China Rural", "2019-10-31", "2020-01-23", "2020-04-08", "2020-11-01")
china.rural.vs.urban <- plot_grid(china.urban.plot, china.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("China_rural_vs_urban.pdf", china.rural.vs.urban)
china.rural.vs.urban#Italy
italy.urban.weekly.df <- NO2.df.filter.fxn("italy", "urban")
italy.rural.weekly.df <- NO2.df.filter.fxn("italy", "rural")
italy.urban.plot <- ITS.plot.fxn(italy.urban.weekly.df, "Italy Urban", "2019-12-01", "2020-03-09", "2020-05-18", "2020-12-24")
italy.rural.plot <- ITS.plot.fxn(italy.rural.weekly.df, "Italy Rural", "2019-12-01", "2020-03-09", "2020-05-18", "2020-12-24")
italy.rural.vs.urban <- plot_grid(italy.urban.plot, italy.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Italy_rural_vs_urban.pdf", italy.rural.vs.urban)
italy.rural.vs.urban #Iraq
iraq.urban.weekly.df <- NO2.df.filter.fxn("iraq", "urban")
iraq.rural.weekly.df <- NO2.df.filter.fxn("iraq", "rural")
iraq.urban.plot <- ITS.plot.fxn(iraq.urban.weekly.df, "Iraq Urban", "2019-12-01", "2020-04-04", "2020-05-18", "2020-12-24") #End date is uncertain, seems to be flux of lockdown and no lockdown depending on holidays.
iraq.rural.plot <- ITS.plot.fxn(iraq.rural.weekly.df, "Iraq Rural", "2019-12-01", "2020-04-04", "2020-05-18", "2020-12-24")
iraq.rural.vs.urban <- plot_grid(iraq.urban.plot, iraq.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("Iraq_rural_vs_urban.pdf", iraq.rural.vs.urban)
iraq.rural.vs.urban #India
india.urban.weekly.df <- NO2.df.filter.fxn("india", "urban")
india.rural.weekly.df <- NO2.df.filter.fxn("india", "rural")
india.urban.plot <- ITS.plot.fxn(india.urban.weekly.df, "India Urban", "2019-12-01", "2020-03-24", "2020-05-31", "2020-12-24") #End date is uncertain, seems to be flux of lockdown and no lockdown depending on holidays.
india.rural.plot <- ITS.plot.fxn(india.rural.weekly.df, "India Rural", "2019-12-01", "2020-03-24", "2020-05-31", "2020-12-24")
india.rural.vs.urban <- plot_grid(india.urban.plot, india.rural.plot, labels = c('A', 'B'), ncol = 1)
ggsave("India_rural_vs_urban.pdf", india.rural.vs.urban)
india.rural.vs.urban col = c("#084594","#990000")
#Function to filter NO2 data and make df for plotting.
NO2.df.filter.fxn <- function(location, type, date.start, date.end) {
weekly.df <- read.csv(file = paste0("time_series_csv/", location, ".", type, ".weekly.NO2.csv"))
weekly.df$Date <- as.Date(weekly.df$Date)
weekly.df$Period <- as.factor(weekly.df$Period)
NO2.19 <- weekly.df %>% dplyr::filter(Period == 2019)
NO2.19 <- NO2.19[NO2.19$Date >= date.start & NO2.19$Date <= date.end, ] %>%
dplyr::mutate(covid_lockdown = rep(c(0,1),c(12,12)),year2020 = 0,no_of_weeks = seq(1:24))
NO2.20 <- weekly.df %>% dplyr::filter(Period == 2020)
NO2.20 <- NO2.20[NO2.20$Date >= date.start & NO2.20$Date <= date.end, ] %>%
dplyr::mutate(covid_lockdown = rep(c(0,1),c(12,12)),year2020 = 1,no_of_weeks = seq(1:24))
NO2.df <- rbind(NO2.19,NO2.20)
NO2.df
}
#ggplot2 scatter plot for observation
scatter_gplot <- function(data,ylim, xintercept,location){
#convert year to factor
data$year2020 <- as.factor(data$year2020)
#plot
ggplot(data, aes(y=NO2_Concentration,x=no_of_weeks,colour=year2020)) +
geom_point(size=2) +
scale_color_manual(values=col) +
#add line to denote lockdown
geom_vline(xintercept=xintercept, linetype="twodash",colour="darkred",size=1.4) +
ylim(0,ylim) +
labs(x="Weeks", y=paste(location,"NO2 estimates in 2019 vs 2020"),colour = "Year2020") +
theme_bw() +
theme(legend.title = element_text(size=9))
}
#main plot
period_scatter_plot <- function(data,ylim,xlockdown,location,date.start,date.end,model){
datanew <- data.frame(NO2_Concentration=mean(data$NO2_Concentration),covid_lockdown=rep(c(0,1,0,1),c(120,120,120,120)), no_of_weeks=c((1:240/10), (1:240/10)), year2020 = rep(c(0,1),c(240, 240)))
# We generate predicted values based on the model in order to create a plot
# need to reconfirm the mean multiplier value ; using 10 for now
pred1 <- predict(model,datanew, type="response") #/mean(data$pollution_estimate)*10
#This can then be plotted along with a scatter graph (see above)
#plot for 2015-2019
data.2019 <- data %>% filter(., year2020 == 0) %>% select(., NO2_Concentration, no_of_weeks)
plot(NO2_Concentration ~ no_of_weeks, data = data.2019,
type="n",ylim=c(00,ylim),xlab="Date", ylab=paste0("NO2 estimates"),
bty="l", xaxt="n")
rect(xlockdown,0,24,ylim,col=grey(0.9),border=F)
points(NO2_Concentration ~ no_of_weeks,data = data.2019,cex=0.7,pch=16,col=alpha(col[1],0.5))
legend("topright", inset=.05, legend=c("2019", "2020"), col=alpha(col,0.5),pch=16,cex=0.7)
#plot for 2020
data.2020 <- data %>% filter(., year2020 == 1) %>% select(., NO2_Concentration, no_of_weeks)
par(new=TRUE, font.axis=2)
plot(NO2_Concentration ~ no_of_weeks,data = data.2020, type="n",ylim=c(00,ylim),xlab="Date", ylab=paste0("NO2 estimates"), bty="l", xaxt="n")
points(NO2_Concentration ~ no_of_weeks,data = data.2020,cex=0.7,pch=16,col=alpha(col[2],0.5))
date.list <- data$Date
date.list <- date.list[1:27]
date.list.seq <- date.list[seq(1, length(date.list), 5)]
axis(1,at=c(0,5,10,15,20,25),labels=date.list.seq)
#Add prediction lines
lines(datanew$no_of_weeks[1:240],pred1[1:240],col=col[1],lwd = 1.5) #regular model, 2019
lines(datanew$no_of_weeks[241:480],pred1[241:480],col=col[2],lwd = 1.5) #regular model, 2020
title(paste(location,"NO2,", date.start, "to", date.end, "2019 vs 2020"))
# to plot the counterfactual scenario we create a data frame as if covid lockdown (the intervention) was never being implemented
datanew.ctr <- data.frame(NO2_Concentration=mean(data$NO2_Concentration),covid_lockdown=0, no_of_weeks=c((1:240/10), (1:240/10)), year2020 = rep(c(0,1),c(240, 240)))
# generate predictions under the counterfactual scenario and add it to the plot
pred1b <- predict(model,datanew.ctr, type="response") #/mean(data$pollution_estimate)*10
lines(datanew.ctr$no_of_weeks[1:240],pred1b[1:240],col=col[1],lty=2,lwd = 1.5) #counterfactual model, 2019
lines(datanew.ctr$no_of_weeks[241:480],pred1b[241:480],col=col[2],lty=2,lwd = 1.5) #counterfactual model, 2020
}#Urban
world.urban.NO2 <- NO2.df.filter.fxn("world", "urban", as.Date("2019-11-07"), as.Date("2020-04-17"))
#Scatter plot
scatter_gplot(world.urban.NO2, 10E-5, 12, "Urban World")
#Tabulate pollution before and after lockdown
summary(world.urban.NO2)
summary(world.urban.NO2$NO2_Concentration[world.urban.NO2$covid_lockdown==0])
summary(world.urban.NO2$NO2_Concentration[world.urban.NO2$covid_lockdown==1])
#OLS regression
period.model.world.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=world.urban.NO2)
summary(period.model.world.urban)
#Plot
period_scatter_plot(world.urban.NO2,ylim=10E-5, xlockdown=12,location="Urban World",date.start="Nov 7th", date.end="April 17th",model=period.model.world.urban)
#Rural
world.rural.NO2 <- NO2.df.filter.fxn("world", "rural", as.Date("2019-11-07"), as.Date("2020-04-17"))
#Scatter plot
scatter_gplot(world.rural.NO2, 10E-5, 12, "Rural World")
#Tabulate pollution before and after lockdown
summary(world.rural.NO2)
summary(world.rural.NO2$NO2_Concentration[world.rural.NO2$covid_lockdown==0])
summary(world.rural.NO2$NO2_Concentration[world.rural.NO2$covid_lockdown==1])
#OLS regression
period.model.world.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=world.rural.NO2)
summary(period.model.world.rural)
#Plot
period_scatter_plot(world.rural.NO2,ylim=10E-5, xlockdown=12,location="Rural World",date.start="Nov 7th", date.end="April 17th",model=period.model.world.rural)#Urban
czechia.urban.NO2 <- NO2.df.filter.fxn("czechia", "urban", as.Date("2019-12-22"), as.Date("2020-06-01"))
#Scatter plot
scatter_gplot(czechia.urban.NO2, 10E-5, 12, "Urban Czechia")#Tabulate pollution before and after lockdown
summary(czechia.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-22
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-31
## Median :44.00 Mode :character Median :2020-03-12
## Mean :44.00 Mean :2020-03-12
## 3rd Qu.:72.25 3rd Qu.:2020-04-21
## Max. :84.00 Max. :2020-06-01
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.243e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.830e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :3.258e-05 Median :0.5 Median :0.5
## Mean :3.658e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:4.207e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :9.019e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(czechia.urban.NO2$NO2_Concentration[czechia.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.243e-05 3.116e-05 4.179e-05 4.263e-05 5.670e-05 9.019e-05
summary(czechia.urban.NO2$NO2_Concentration[czechia.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.809e-05 2.493e-05 3.091e-05 3.052e-05 3.421e-05 5.071e-05
#OLS regression
period.model.czechia.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=czechia.urban.NO2)
summary(period.model.czechia.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = czechia.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.997e-05 -4.762e-06 -9.820e-07 5.508e-06 5.007e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.422e-05 7.777e-06 4.400 7.82e-05 ***
## no_of_weeks 1.473e-06 1.057e-06 1.394 0.1710
## year2020 2.269e-05 1.100e-05 2.063 0.0456 *
## covid_lockdown 2.941e-05 2.135e-05 1.377 0.1761
## no_of_weeks:year2020 -3.849e-06 1.494e-06 -2.576 0.0138 *
## year2020:covid_lockdown -3.420e-05 3.020e-05 -1.133 0.2642
## no_of_weeks:covid_lockdown -3.154e-06 1.494e-06 -2.111 0.0411 *
## no_of_weeks:year2020:covid_lockdown 4.256e-06 2.113e-06 2.014 0.0508 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.264e-05 on 40 degrees of freedom
## Multiple R-squared: 0.363, Adjusted R-squared: 0.2516
## F-statistic: 3.257 on 7 and 40 DF, p-value: 0.007856
#Plot
period_scatter_plot(czechia.urban.NO2,ylim=10E-5, xlockdown=12,location="Urban Czechia",date.start="Dec 22nd", date.end="June 1st",model=period.model.czechia.urban) #Rural
czechia.rural.NO2 <- NO2.df.filter.fxn("czechia", "rural", as.Date("2019-12-22"), as.Date("2020-06-01"))
#Scatter plot
scatter_gplot(czechia.rural.NO2, 10E-5, 12, "Rural Czechia")#Tabulate pollution before and after lockdown
summary(czechia.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-22
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-31
## Median :44.00 Mode :character Median :2020-03-12
## Mean :44.00 Mean :2020-03-12
## 3rd Qu.:72.25 3rd Qu.:2020-04-21
## Max. :84.00 Max. :2020-06-01
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.211e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.841e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :3.573e-05 Median :0.5 Median :0.5
## Mean :3.762e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:4.393e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :6.777e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(czechia.rural.NO2$NO2_Concentration[czechia.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.211e-05 3.304e-05 4.206e-05 4.358e-05 5.684e-05 6.777e-05
summary(czechia.rural.NO2$NO2_Concentration[czechia.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.898e-05 2.610e-05 3.149e-05 3.165e-05 3.602e-05 4.978e-05
#OLS regression
period.model.czechia.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=czechia.rural.NO2)
summary(period.model.czechia.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = czechia.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.563e-05 -5.039e-06 -1.264e-06 6.383e-06 2.594e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.649e-05 6.239e-06 4.246 0.000126 ***
## no_of_weeks 2.660e-06 8.478e-07 3.137 0.003194 **
## year2020 3.217e-05 8.824e-06 3.646 0.000759 ***
## covid_lockdown 3.923e-05 1.713e-05 2.290 0.027368 *
## no_of_weeks:year2020 -5.012e-06 1.199e-06 -4.181 0.000154 ***
## year2020:covid_lockdown -4.283e-05 2.423e-05 -1.768 0.084709 .
## no_of_weeks:covid_lockdown -4.393e-06 1.199e-06 -3.664 0.000720 ***
## no_of_weeks:year2020:covid_lockdown 5.371e-06 1.695e-06 3.168 0.002938 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.014e-05 on 40 degrees of freedom
## Multiple R-squared: 0.5117, Adjusted R-squared: 0.4262
## F-statistic: 5.988 on 7 and 40 DF, p-value: 8.271e-05
#Plot
period_scatter_plot(czechia.rural.NO2,ylim=10E-5, xlockdown=12,location="Rural Czechia",date.start="Dec 22nd", date.end="June 1st",model=period.model.czechia.rural)#Urban
slovenia.urban.NO2 <- NO2.df.filter.fxn("slovenia", "urban", as.Date("2019-12-22"), as.Date("2020-06-01"))
#Scatter plot
scatter_gplot(slovenia.urban.NO2, 6E-5, 12, "Urban Slovenia")#Tabulate pollution before and after lockdown
summary(slovenia.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-22
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-31
## Median :44.00 Mode :character Median :2020-03-12
## Mean :44.00 Mean :2020-03-12
## 3rd Qu.:72.25 3rd Qu.:2020-04-21
## Max. :84.00 Max. :2020-06-01
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.049e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.819e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :2.646e-05 Median :0.5 Median :0.5
## Mean :2.664e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:3.267e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :5.641e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(slovenia.urban.NO2$NO2_Concentration[slovenia.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.049e-05 2.715e-05 3.249e-05 3.205e-05 3.551e-05 5.641e-05
summary(slovenia.urban.NO2$NO2_Concentration[slovenia.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.205e-05 1.725e-05 1.927e-05 2.122e-05 2.550e-05 3.427e-05
#OLS regression
period.model.slovenia.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=czechia.urban.NO2)
summary(period.model.slovenia.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = czechia.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.997e-05 -4.762e-06 -9.820e-07 5.508e-06 5.007e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.422e-05 7.777e-06 4.400 7.82e-05 ***
## no_of_weeks 1.473e-06 1.057e-06 1.394 0.1710
## year2020 2.269e-05 1.100e-05 2.063 0.0456 *
## covid_lockdown 2.941e-05 2.135e-05 1.377 0.1761
## no_of_weeks:year2020 -3.849e-06 1.494e-06 -2.576 0.0138 *
## year2020:covid_lockdown -3.420e-05 3.020e-05 -1.133 0.2642
## no_of_weeks:covid_lockdown -3.154e-06 1.494e-06 -2.111 0.0411 *
## no_of_weeks:year2020:covid_lockdown 4.256e-06 2.113e-06 2.014 0.0508 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.264e-05 on 40 degrees of freedom
## Multiple R-squared: 0.363, Adjusted R-squared: 0.2516
## F-statistic: 3.257 on 7 and 40 DF, p-value: 0.007856
#Plot
period_scatter_plot(slovenia.urban.NO2,ylim=6E-5, xlockdown=12,location="Urban Slovenia",date.start="Dec 22nd", date.end="June 1st",model=period.model.slovenia.urban)#Rural
slovenia.rural.NO2 <- NO2.df.filter.fxn("slovenia", "rural", as.Date("2019-12-22"), as.Date("2020-06-01"))
#Scatter plot
scatter_gplot(slovenia.rural.NO2, 6E-5, 12, "Rural Slovenia")#Tabulate pollution before and after lockdown
summary(slovenia.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-22
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-31
## Median :44.00 Mode :character Median :2020-03-12
## Mean :44.00 Mean :2020-03-12
## 3rd Qu.:72.25 3rd Qu.:2020-04-21
## Max. :84.00 Max. :2020-06-01
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.555e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.125e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :2.934e-05 Median :0.5 Median :0.5
## Mean :3.051e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:3.687e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :6.492e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(slovenia.rural.NO2$NO2_Concentration[slovenia.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.027e-05 3.354e-05 3.701e-05 3.833e-05 4.033e-05 6.492e-05
summary(slovenia.rural.NO2$NO2_Concentration[slovenia.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.555e-05 1.949e-05 2.200e-05 2.269e-05 2.500e-05 3.180e-05
#OLS regression
period.model.slovenia.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=slovenia.rural.NO2)
summary(period.model.slovenia.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = slovenia.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.501e-05 -3.483e-06 -7.290e-07 2.068e-06 3.016e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.266e-05 4.703e-06 6.945 2.24e-08 ***
## no_of_weeks 5.247e-07 6.390e-07 0.821 0.4164
## year2020 1.400e-05 6.651e-06 2.105 0.0416 *
## covid_lockdown 1.239e-05 1.291e-05 0.959 0.3432
## no_of_weeks:year2020 -1.458e-06 9.037e-07 -1.613 0.1146
## year2020:covid_lockdown -2.693e-05 1.826e-05 -1.475 0.1482
## no_of_weeks:covid_lockdown -1.647e-06 9.037e-07 -1.822 0.0759 .
## no_of_weeks:year2020:covid_lockdown 1.984e-06 1.278e-06 1.553 0.1284
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.641e-06 on 40 degrees of freedom
## Multiple R-squared: 0.6007, Adjusted R-squared: 0.5309
## F-statistic: 8.598 on 7 and 40 DF, p-value: 2.127e-06
#Plot
period_scatter_plot(slovenia.rural.NO2,ylim=6E-5, xlockdown=12,location="Rural Slovenia",date.start="Dec 22nd", date.end="June 1st",model=period.model.slovenia.rural)#Urban
sweden.urban.NO2 <- NO2.df.filter.fxn("sweden", "urban", as.Date("2019-12-22"), as.Date("2020-06-01"))
#Scatter plot
scatter_gplot(sweden.urban.NO2, 6E-5, 12, "Urban Sweden")#Tabulate pollution before and after lockdown
summary(sweden.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-22
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-31
## Median :44.00 Mode :character Median :2020-03-12
## Mean :44.00 Mean :2020-03-12
## 3rd Qu.:72.25 3rd Qu.:2020-04-21
## Max. :84.00 Max. :2020-06-01
##
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :5.30e-06 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.50e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :1.96e-05 Median :0.5 Median :0.5
## Mean :2.18e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:2.41e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :5.79e-05 Max. :1.0 Max. :1.0
## NA's :3
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
##
summary(sweden.urban.NO2$NO2_Concentration[sweden.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 5.30e-06 1.20e-05 1.96e-05 2.49e-05 3.68e-05 5.79e-05 3
summary(sweden.urban.NO2$NO2_Concentration[sweden.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 9.791e-06 1.533e-05 1.959e-05 1.906e-05 2.320e-05 2.896e-05
#OLS regression
period.model.sweden.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=sweden.urban.NO2)
summary(period.model.sweden.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = sweden.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.937e-05 -4.499e-06 2.180e-08 3.762e-06 1.954e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.710e-05 7.798e-06 2.193 0.034651 *
## no_of_weeks 3.749e-07 9.365e-07 0.400 0.691255
## year2020 3.691e-05 9.340e-06 3.951 0.000336 ***
## covid_lockdown 8.338e-06 1.528e-05 0.546 0.588669
## no_of_weeks:year2020 -4.285e-06 1.168e-06 -3.667 0.000766 ***
## year2020:covid_lockdown -3.898e-05 2.081e-05 -1.874 0.068881 .
## no_of_weeks:covid_lockdown -6.197e-07 1.168e-06 -0.530 0.598979
## no_of_weeks:year2020:covid_lockdown 4.197e-06 1.530e-06 2.743 0.009334 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.353e-06 on 37 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.543, Adjusted R-squared: 0.4565
## F-statistic: 6.281 on 7 and 37 DF, p-value: 6.861e-05
#Plot
period_scatter_plot(sweden.urban.NO2,ylim=6E-5, xlockdown=12,location="Urban Sweden",date.start="Dec 22nd", date.end="June 1st",model=period.model.sweden.urban)#Rural
sweden.rural.NO2 <- NO2.df.filter.fxn("sweden", "rural", as.Date("2019-12-22"), as.Date("2020-06-01"))
#Scatter plot
scatter_gplot(sweden.rural.NO2, 6E-5, 12, "Rural Sweden")#Tabulate pollution before and after lockdown
summary(sweden.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-22
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-31
## Median :44.00 Mode :character Median :2020-03-12
## Mean :44.00 Mean :2020-03-12
## 3rd Qu.:72.25 3rd Qu.:2020-04-21
## Max. :84.00 Max. :2020-06-01
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :2.605e-06 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:9.806e-06 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :1.283e-05 Median :0.5 Median :0.5
## Mean :1.531e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:1.586e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :4.947e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(sweden.rural.NO2$NO2_Concentration[sweden.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.605e-06 8.778e-06 1.353e-05 1.814e-05 2.197e-05 4.947e-05
summary(sweden.rural.NO2$NO2_Concentration[sweden.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 5.449e-06 1.057e-05 1.204e-05 1.248e-05 1.428e-05 2.241e-05
#OLS regression
period.model.sweden.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=sweden.rural.NO2)
summary(period.model.sweden.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = sweden.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.095e-05 -3.294e-06 -4.675e-07 2.846e-06 2.049e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.074e-05 3.827e-06 2.807 0.007700 **
## no_of_weeks 3.661e-07 5.200e-07 0.704 0.485537
## year2020 3.644e-05 5.412e-06 6.733 4.42e-08 ***
## covid_lockdown -2.130e-06 1.051e-05 -0.203 0.840371
## no_of_weeks:year2020 -4.062e-06 7.354e-07 -5.524 2.20e-06 ***
## year2020:covid_lockdown -3.195e-05 1.486e-05 -2.150 0.037648 *
## no_of_weeks:covid_lockdown -1.106e-07 7.354e-07 -0.150 0.881200
## no_of_weeks:year2020:covid_lockdown 3.727e-06 1.040e-06 3.583 0.000911 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.218e-06 on 40 degrees of freedom
## Multiple R-squared: 0.6591, Adjusted R-squared: 0.5994
## F-statistic: 11.05 on 7 and 40 DF, p-value: 1.12e-07
#Plot
period_scatter_plot(sweden.rural.NO2,ylim=6E-5, xlockdown=12,location="Rural Sweden",date.start="Dec 22nd", date.end="June 1st",model=period.model.sweden.rural)#Urban
uruguay.urban.NO2 <- NO2.df.filter.fxn("uruguay", "urban", as.Date("2019-12-19"), as.Date("2020-05-29"))
#Scatter plot
scatter_gplot(uruguay.urban.NO2, 3.5E-5, 12, "Urban Uruguay")#Tabulate pollution before and after lockdown
summary(uruguay.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-19
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-28
## Median :44.00 Mode :character Median :2020-03-09
## Mean :44.00 Mean :2020-03-09
## 3rd Qu.:72.25 3rd Qu.:2020-04-18
## Max. :84.00 Max. :2020-05-29
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :3.457e-06 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.047e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :1.228e-05 Median :0.5 Median :0.5
## Mean :1.344e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:1.473e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :3.687e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(uruguay.urban.NO2$NO2_Concentration[uruguay.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.457e-06 9.941e-06 1.096e-05 1.158e-05 1.371e-05 1.784e-05
summary(uruguay.urban.NO2$NO2_Concentration[uruguay.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 6.903e-06 1.119e-05 1.347e-05 1.530e-05 1.780e-05 3.687e-05
#OLS regression
period.model.uruguay.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=uruguay.urban.NO2)
summary(period.model.uruguay.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = uruguay.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.372e-06 -1.977e-06 -1.435e-07 1.739e-06 1.159e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.093e-05 2.452e-06 4.458 6.53e-05 ***
## no_of_weeks 1.264e-07 3.332e-07 0.379 0.7064
## year2020 -1.713e-06 3.468e-06 -0.494 0.6241
## covid_lockdown -1.150e-05 6.734e-06 -1.708 0.0954 .
## no_of_weeks:year2020 2.089e-07 4.713e-07 0.443 0.6600
## year2020:covid_lockdown -1.222e-05 9.523e-06 -1.283 0.2069
## no_of_weeks:covid_lockdown 6.848e-07 4.713e-07 1.453 0.1540
## no_of_weeks:year2020:covid_lockdown 6.372e-07 6.665e-07 0.956 0.3448
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.985e-06 on 40 degrees of freedom
## Multiple R-squared: 0.5207, Adjusted R-squared: 0.4369
## F-statistic: 6.209 on 7 and 40 DF, p-value: 5.923e-05
#Plot
period_scatter_plot(uruguay.urban.NO2,ylim=3.5E-5, xlockdown=12,location="Urban Uruguay",date.start="Dec 19th", date.end="May 29th",model=period.model.uruguay.urban)#Rural
uruguay.rural.NO2 <- NO2.df.filter.fxn("uruguay", "rural", as.Date("2019-12-19"), as.Date("2020-05-29"))
#Scatter plot
scatter_gplot(uruguay.rural.NO2, 3.5E-5, 12, "Rural Uruguay")#Tabulate pollution before and after lockdown
summary(uruguay.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-19
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-28
## Median :44.00 Mode :character Median :2020-03-09
## Mean :44.00 Mean :2020-03-09
## 3rd Qu.:72.25 3rd Qu.:2020-04-18
## Max. :84.00 Max. :2020-05-29
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :5.938e-06 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.070e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :1.247e-05 Median :0.5 Median :0.5
## Mean :1.310e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:1.449e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :2.402e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(uruguay.rural.NO2$NO2_Concentration[uruguay.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 5.938e-06 1.017e-05 1.136e-05 1.197e-05 1.380e-05 1.880e-05
summary(uruguay.rural.NO2$NO2_Concentration[uruguay.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 9.249e-06 1.115e-05 1.287e-05 1.424e-05 1.656e-05 2.402e-05
#OLS regression
period.model.uruguay.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=uruguay.rural.NO2)
summary(period.model.uruguay.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = uruguay.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.534e-06 -1.657e-06 -5.385e-07 1.715e-06 7.190e-06
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.179e-05 1.913e-06 6.163 2.78e-07 ***
## no_of_weeks -1.196e-08 2.599e-07 -0.046 0.96353
## year2020 -4.554e-07 2.705e-06 -0.168 0.86716
## covid_lockdown -1.423e-05 5.252e-06 -2.709 0.00989 **
## no_of_weeks:year2020 1.498e-07 3.675e-07 0.408 0.68575
## year2020:covid_lockdown 3.954e-06 7.427e-06 0.532 0.59740
## no_of_weeks:covid_lockdown 8.814e-07 3.675e-07 2.398 0.02123 *
## no_of_weeks:year2020:covid_lockdown -2.752e-07 5.198e-07 -0.529 0.59939
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.108e-06 on 40 degrees of freedom
## Multiple R-squared: 0.4038, Adjusted R-squared: 0.2994
## F-statistic: 3.87 on 7 and 40 DF, p-value: 0.002643
#Plot
period_scatter_plot(uruguay.rural.NO2,ylim=3.5E-5, xlockdown=12,location="Rural Uruguay",date.start="Dec 19th", date.end="May 29th",model=period.model.uruguay.rural)#Urban
lithuania.urban.NO2 <- NO2.df.filter.fxn("lithuania", "urban", as.Date("2019-12-22"), as.Date("2020-06-01"))
#Scatter plot
scatter_gplot(lithuania.urban.NO2, 5E-5, 12, "Urban Lithuania")#Tabulate pollution before and after lockdown
summary(lithuania.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-22
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-31
## Median :44.00 Mode :character Median :2020-03-12
## Mean :44.00 Mean :2020-03-12
## 3rd Qu.:72.25 3rd Qu.:2020-04-21
## Max. :84.00 Max. :2020-06-01
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :7.077e-06 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.646e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :2.133e-05 Median :0.5 Median :0.5
## Mean :2.313e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:2.838e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :5.935e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(lithuania.urban.NO2$NO2_Concentration[lithuania.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 7.077e-06 1.578e-05 2.368e-05 2.539e-05 3.559e-05 5.935e-05
summary(lithuania.urban.NO2$NO2_Concentration[lithuania.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 9.372e-06 1.767e-05 2.095e-05 2.086e-05 2.328e-05 3.083e-05
#OLS regression
period.model.lithuania.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=lithuania.urban.NO2)
summary(period.model.lithuania.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = lithuania.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.278e-05 -4.739e-06 -3.426e-07 4.911e-06 2.808e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.624e-06 5.949e-06 1.282 0.20737
## no_of_weeks 1.808e-06 8.083e-07 2.237 0.03092 *
## year2020 2.440e-05 8.413e-06 2.900 0.00603 **
## covid_lockdown 1.319e-05 1.633e-05 0.808 0.42408
## no_of_weeks:year2020 -1.903e-06 1.143e-06 -1.665 0.10376
## year2020:covid_lockdown -1.132e-05 2.310e-05 -0.490 0.62665
## no_of_weeks:covid_lockdown -1.753e-06 1.143e-06 -1.534 0.13298
## no_of_weeks:year2020:covid_lockdown 1.092e-06 1.617e-06 0.675 0.50345
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.666e-06 on 40 degrees of freedom
## Multiple R-squared: 0.3111, Adjusted R-squared: 0.1906
## F-statistic: 2.581 on 7 and 40 DF, p-value: 0.02706
#Plot
period_scatter_plot(lithuania.urban.NO2,ylim=5E-5, xlockdown=12,location="Urban Lithuania",date.start="Dec 22nd", date.end="June 1st",model=period.model.lithuania.urban)#Rural
lithuania.rural.NO2 <- NO2.df.filter.fxn("lithuania", "rural", as.Date("2019-12-22"), as.Date("2020-06-01"))
#Scatter plot
scatter_gplot(lithuania.rural.NO2, 5E-5, 12, "Rural Lithuania")#Tabulate pollution before and after lockdown
summary(lithuania.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-22
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-31
## Median :44.00 Mode :character Median :2020-03-12
## Mean :44.00 Mean :2020-03-12
## 3rd Qu.:72.25 3rd Qu.:2020-04-21
## Max. :84.00 Max. :2020-06-01
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :6.854e-06 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.733e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :2.142e-05 Median :0.5 Median :0.5
## Mean :2.278e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:2.713e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :5.170e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(lithuania.rural.NO2$NO2_Concentration[lithuania.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 6.854e-06 1.454e-05 2.525e-05 2.530e-05 3.439e-05 5.170e-05
summary(lithuania.rural.NO2$NO2_Concentration[lithuania.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.013e-05 1.794e-05 2.012e-05 2.026e-05 2.366e-05 2.859e-05
#OLS regression
period.model.lithuania.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=lithuania.rural.NO2)
summary(period.model.lithuania.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = lithuania.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.226e-05 -4.529e-06 -1.041e-06 4.278e-06 2.182e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.222e-06 5.286e-06 1.366 0.179500
## no_of_weeks 1.933e-06 7.183e-07 2.691 0.010334 *
## year2020 2.764e-05 7.476e-06 3.697 0.000654 ***
## covid_lockdown 1.398e-05 1.451e-05 0.963 0.341120
## no_of_weeks:year2020 -2.555e-06 1.016e-06 -2.516 0.016002 *
## year2020:covid_lockdown -1.804e-05 2.053e-05 -0.879 0.384751
## no_of_weeks:covid_lockdown -1.928e-06 1.016e-06 -1.898 0.064952 .
## no_of_weeks:year2020:covid_lockdown 1.923e-06 1.436e-06 1.339 0.188247
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.589e-06 on 40 degrees of freedom
## Multiple R-squared: 0.3666, Adjusted R-squared: 0.2557
## F-statistic: 3.307 on 7 and 40 DF, p-value: 0.007175
#Plot
period_scatter_plot(lithuania.rural.NO2,ylim=5E-5, xlockdown=12,location="Rural Lithuania",date.start="Dec 22nd", date.end="June 1st",model=period.model.lithuania.rural)#Urban
us.urban.NO2 <- NO2.df.filter.fxn("us", "urban", as.Date("2019-12-25"), as.Date("2020-06-04"))
#Scatter plot
scatter_gplot(us.urban.NO2, 5E-5, 12, "Urban U.S.")#Tabulate pollution before and after lockdown
summary(us.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-25
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-02-03
## Median :44.00 Mode :character Median :2020-03-15
## Mean :44.00 Mean :2020-03-15
## 3rd Qu.:72.25 3rd Qu.:2020-04-24
## Max. :84.00 Max. :2020-06-04
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :2.028e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.684e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :2.994e-05 Median :0.5 Median :0.5
## Mean :3.115e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:3.649e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :4.638e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(us.urban.NO2$NO2_Concentration[us.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.762e-05 3.186e-05 3.608e-05 3.538e-05 3.856e-05 4.638e-05
summary(us.urban.NO2$NO2_Concentration[us.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.028e-05 2.525e-05 2.681e-05 2.692e-05 2.769e-05 3.803e-05
#OLS regression
period.model.us.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=us.urban.NO2)
summary(period.model.us.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = us.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -9.022e-06 -2.588e-06 4.427e-07 2.082e-06 1.071e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.746e-05 2.589e-06 14.468 <2e-16 ***
## no_of_weeks -2.417e-07 3.518e-07 -0.687 0.4961
## year2020 8.424e-07 3.662e-06 0.230 0.8192
## covid_lockdown 6.080e-06 7.109e-06 0.855 0.3975
## no_of_weeks:year2020 -2.856e-07 4.975e-07 -0.574 0.5691
## year2020:covid_lockdown -1.738e-05 1.005e-05 -1.729 0.0915 .
## no_of_weeks:covid_lockdown -5.717e-07 4.975e-07 -1.149 0.2573
## no_of_weeks:year2020:covid_lockdown 1.010e-06 7.036e-07 1.435 0.1589
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.207e-06 on 40 degrees of freedom
## Multiple R-squared: 0.6014, Adjusted R-squared: 0.5317
## F-statistic: 8.623 on 7 and 40 DF, p-value: 2.06e-06
#Plot
period_scatter_plot(us.urban.NO2,ylim=5E-5, xlockdown=12,location="Urban U.S.",date.start="Dec 25th", date.end="June 4th",model=period.model.us.urban)#Rural
us.rural.NO2 <- NO2.df.filter.fxn("us", "rural", as.Date("2019-12-25"), as.Date("2020-06-04"))
#Scatter plot
scatter_gplot(us.rural.NO2, 5E-5, 12, "Rural U.S.")#Tabulate pollution before and after lockdown
summary(us.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-25
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-02-03
## Median :44.00 Mode :character Median :2020-03-15
## Mean :44.00 Mean :2020-03-15
## 3rd Qu.:72.25 3rd Qu.:2020-04-24
## Max. :84.00 Max. :2020-06-04
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.526e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.870e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :2.039e-05 Median :0.5 Median :0.5
## Mean :2.053e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:2.156e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :2.576e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(us.rural.NO2$NO2_Concentration[us.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.816e-05 1.987e-05 2.124e-05 2.156e-05 2.316e-05 2.576e-05
summary(us.rural.NO2$NO2_Concentration[us.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.526e-05 1.821e-05 1.951e-05 1.949e-05 2.067e-05 2.417e-05
#OLS regression
period.model.us.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=us.rural.NO2)
summary(period.model.us.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = us.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.318e-06 -1.556e-06 6.520e-08 1.106e-06 3.536e-06
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.290e-05 1.168e-06 19.612 <2e-16 ***
## no_of_weeks -2.691e-07 1.587e-07 -1.696 0.0976 .
## year2020 1.284e-07 1.651e-06 0.078 0.9384
## covid_lockdown 1.465e-06 3.206e-06 0.457 0.6503
## no_of_weeks:year2020 1.068e-07 2.244e-07 0.476 0.6365
## year2020:covid_lockdown -7.469e-06 4.534e-06 -1.647 0.1073
## no_of_weeks:covid_lockdown 2.227e-08 2.244e-07 0.099 0.9214
## no_of_weeks:year2020:covid_lockdown 2.564e-07 3.173e-07 0.808 0.4239
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.897e-06 on 40 degrees of freedom
## Multiple R-squared: 0.3651, Adjusted R-squared: 0.254
## F-statistic: 3.286 on 7 and 40 DF, p-value: 0.00746
#Plot
period_scatter_plot(us.rural.NO2,ylim=5E-5, xlockdown=12,location="Rural U.S.",date.start="Dec 25th", date.end="June 4th",model=period.model.us.rural)#Urban
netherlands.urban.NO2 <- NO2.df.filter.fxn("netherlands", "urban", as.Date("2019-12-21"), as.Date("2020-05-31"))
#Scatter plot
scatter_gplot(netherlands.urban.NO2, 1.5E-4, 12, "Urban Netherlands")#Tabulate pollution before and after lockdown
summary(netherlands.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-21
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-30
## Median :44.00 Mode :character Median :2020-03-11
## Mean :44.00 Mean :2020-03-11
## 3rd Qu.:72.25 3rd Qu.:2020-04-20
## Max. :84.00 Max. :2020-05-31
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.790e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:4.657e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :6.059e-05 Median :0.5 Median :0.5
## Mean :6.589e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:8.140e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1.498e-04 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(netherlands.urban.NO2$NO2_Concentration[netherlands.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.790e-05 4.070e-05 5.422e-05 5.882e-05 7.197e-05 1.241e-04
summary(netherlands.urban.NO2$NO2_Concentration[netherlands.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 4.263e-05 5.414e-05 7.137e-05 7.295e-05 8.283e-05 1.498e-04
#OLS regression
period.model.netherlands.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=netherlands.urban.NO2)
summary(period.model.netherlands.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = netherlands.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.958e-05 -1.497e-05 -1.016e-06 1.237e-05 6.507e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.099e-05 1.553e-05 2.640 0.0118 *
## no_of_weeks 3.341e-06 2.110e-06 1.583 0.1213
## year2020 3.595e-05 2.196e-05 1.637 0.1095
## covid_lockdown 9.833e-05 4.264e-05 2.306 0.0264 *
## no_of_weeks:year2020 -6.727e-06 2.984e-06 -2.254 0.0297 *
## year2020:covid_lockdown -6.397e-05 6.030e-05 -1.061 0.2951
## no_of_weeks:covid_lockdown -6.554e-06 2.984e-06 -2.196 0.0339 *
## no_of_weeks:year2020:covid_lockdown 7.493e-06 4.220e-06 1.776 0.0834 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.523e-05 on 40 degrees of freedom
## Multiple R-squared: 0.2713, Adjusted R-squared: 0.1437
## F-statistic: 2.127 on 7 and 40 DF, p-value: 0.06265
#Plot
period_scatter_plot(netherlands.urban.NO2,ylim=1.5E-4, xlockdown=12,location="Urban Netherlands",date.start="Dec 21st", date.end="May 31st",model=period.model.netherlands.urban)#Rural
netherlands.rural.NO2 <- NO2.df.filter.fxn("netherlands", "rural", as.Date("2019-12-21"), as.Date("2020-05-31"))
#Scatter plot
scatter_gplot(netherlands.rural.NO2, 1.5E-4, 12, "Rural Netherlands")#Tabulate pollution before and after lockdown
summary(netherlands.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-21
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-30
## Median :44.00 Mode :character Median :2020-03-11
## Mean :44.00 Mean :2020-03-11
## 3rd Qu.:72.25 3rd Qu.:2020-04-20
## Max. :84.00 Max. :2020-05-31
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.572e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:4.402e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :5.982e-05 Median :0.5 Median :0.5
## Mean :6.635e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:7.957e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1.382e-04 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(netherlands.rural.NO2$NO2_Concentration[netherlands.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.572e-05 4.083e-05 4.837e-05 5.976e-05 7.657e-05 1.329e-04
summary(netherlands.rural.NO2$NO2_Concentration[netherlands.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 4.054e-05 5.738e-05 7.433e-05 7.294e-05 8.143e-05 1.382e-04
#OLS regression
period.model.netherlands.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=netherlands.rural.NO2)
summary(period.model.netherlands.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = netherlands.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.074e-05 -1.326e-05 5.370e-07 1.160e-05 6.033e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.578e-05 1.549e-05 2.311 0.0261 *
## no_of_weeks 4.344e-06 2.104e-06 2.064 0.0455 *
## year2020 4.070e-05 2.190e-05 1.859 0.0705 .
## covid_lockdown 1.050e-04 4.252e-05 2.470 0.0179 *
## no_of_weeks:year2020 -7.573e-06 2.976e-06 -2.545 0.0149 *
## year2020:covid_lockdown -6.457e-05 6.013e-05 -1.074 0.2893
## no_of_weeks:covid_lockdown -7.609e-06 2.976e-06 -2.557 0.0145 *
## no_of_weeks:year2020:covid_lockdown 8.055e-06 4.208e-06 1.914 0.0628 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.516e-05 on 40 degrees of freedom
## Multiple R-squared: 0.2967, Adjusted R-squared: 0.1736
## F-statistic: 2.411 on 7 and 40 DF, p-value: 0.03707
max(netherlands.urban.NO2$NO2_Concentration)## [1] 0.0001497688
#Plot
period_scatter_plot(netherlands.rural.NO2,ylim=1.5E-4, xlockdown=12,location="Rural Netherlands",date.start="Dec 21st", date.end="May 31st",model=period.model.netherlands.rural)#Urban
estonia.urban.NO2 <- NO2.df.filter.fxn("estonia", "urban", as.Date("2019-12-19"), as.Date("2020-05-29"))
#Scatter plot
scatter_gplot(estonia.urban.NO2, 5E-5, 12, "Urban Estonia")#Tabulate pollution before and after lockdown
summary(estonia.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-19
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-28
## Median :44.00 Mode :character Median :2020-03-09
## Mean :44.00 Mean :2020-03-09
## 3rd Qu.:72.25 3rd Qu.:2020-04-18
## Max. :84.00 Max. :2020-05-29
##
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.0e-06 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.3e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :1.7e-05 Median :0.5 Median :0.5
## Mean :1.8e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:2.1e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :4.2e-05 Max. :1.0 Max. :1.0
## NA's :5
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
##
summary(estonia.urban.NO2$NO2_Concentration[estonia.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 1.0e-06 1.3e-05 1.8e-05 2.0e-05 3.0e-05 4.2e-05 5
summary(estonia.urban.NO2$NO2_Concentration[estonia.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.060e-05 1.262e-05 1.616e-05 1.662e-05 1.865e-05 3.274e-05
#OLS regression
period.model.estonia.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=estonia.urban.NO2)
summary(period.model.estonia.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = estonia.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.731e-05 -3.477e-06 -8.404e-07 3.957e-06 2.024e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.885e-05 8.956e-06 2.105 0.0425 *
## no_of_weeks -3.159e-08 1.071e-06 -0.029 0.9766
## year2020 1.123e-05 1.078e-05 1.041 0.3049
## covid_lockdown 1.281e-05 1.661e-05 0.771 0.4458
## no_of_weeks:year2020 -1.191e-06 1.326e-06 -0.898 0.3751
## year2020:covid_lockdown -2.666e-05 2.254e-05 -1.183 0.2448
## no_of_weeks:covid_lockdown -6.776e-07 1.304e-06 -0.520 0.6066
## no_of_weeks:year2020:covid_lockdown 1.817e-06 1.692e-06 1.074 0.2902
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.891e-06 on 35 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 0.1643, Adjusted R-squared: -0.002864
## F-statistic: 0.9829 on 7 and 35 DF, p-value: 0.4592
#Plot
period_scatter_plot(estonia.urban.NO2,ylim=5E-5, xlockdown=12,location="Urban Estonia",date.start="Dec 19th", date.end="May 29th",model=period.model.estonia.urban)#Rural
estonia.rural.NO2 <- NO2.df.filter.fxn("estonia", "rural", as.Date("2019-12-19"), as.Date("2020-05-29"))
#Scatter plot
scatter_gplot(estonia.rural.NO2, 5E-5, 12, "Rural Estonia")#Tabulate pollution before and after lockdown
summary(estonia.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-19
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-28
## Median :44.00 Mode :character Median :2020-03-09
## Mean :44.00 Mean :2020-03-09
## 3rd Qu.:72.25 3rd Qu.:2020-04-18
## Max. :84.00 Max. :2020-05-29
##
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :3.00e-07 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.31e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :1.60e-05 Median :0.5 Median :0.5
## Mean :1.70e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:2.06e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :3.45e-05 Max. :1.0 Max. :1.0
## NA's :1
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
##
summary(estonia.rural.NO2$NO2_Concentration[estonia.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 3.00e-07 1.17e-05 1.66e-05 1.79e-05 2.63e-05 3.45e-05 1
summary(estonia.rural.NO2$NO2_Concentration[estonia.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.065e-05 1.310e-05 1.572e-05 1.625e-05 1.796e-05 2.711e-05
#OLS regression
period.model.estonia.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=estonia.rural.NO2)
summary(period.model.estonia.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = estonia.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.294e-05 -2.859e-06 2.896e-07 2.861e-06 2.012e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.342e-06 5.009e-06 1.666 0.10382
## no_of_weeks 8.591e-07 6.521e-07 1.318 0.19534
## year2020 2.038e-05 6.542e-06 3.116 0.00344 **
## covid_lockdown 1.655e-05 1.187e-05 1.394 0.17120
## no_of_weeks:year2020 -2.039e-06 8.673e-07 -2.351 0.02387 *
## year2020:covid_lockdown -2.674e-05 1.657e-05 -1.614 0.11463
## no_of_weeks:covid_lockdown -1.252e-06 8.673e-07 -1.443 0.15687
## no_of_weeks:year2020:covid_lockdown 2.234e-06 1.186e-06 1.884 0.06705 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.839e-06 on 39 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.26, Adjusted R-squared: 0.1272
## F-statistic: 1.958 on 7 and 39 DF, p-value: 0.08628
#Plot
period_scatter_plot(estonia.rural.NO2,ylim=5E-5, xlockdown=12,location="Rural Estonia",date.start="Dec 19th", date.end="May 29th",model=period.model.estonia.rural)#Urban
argentina.urban.NO2 <- NO2.df.filter.fxn("argentina", "urban", as.Date("2019-12-26"), as.Date("2020-06-05"))
#Scatter plot
scatter_gplot(argentina.urban.NO2, 2.5E-5, 12, "Urban Argentina")#Tabulate pollution before and after lockdown
summary(argentina.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-26
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-02-04
## Median :44.00 Mode :character Median :2020-03-16
## Mean :44.00 Mean :2020-03-16
## 3rd Qu.:72.25 3rd Qu.:2020-04-25
## Max. :84.00 Max. :2020-06-05
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :7.900e-06 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.146e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :1.341e-05 Median :0.5 Median :0.5
## Mean :1.365e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:1.547e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :2.256e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(argentina.urban.NO2$NO2_Concentration[argentina.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 7.900e-06 1.044e-05 1.207e-05 1.256e-05 1.471e-05 1.811e-05
summary(argentina.urban.NO2$NO2_Concentration[argentina.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.000e-05 1.203e-05 1.468e-05 1.475e-05 1.632e-05 2.256e-05
#OLS regression
period.model.argentina.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=argentina.urban.NO2)
summary(period.model.argentina.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = argentina.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.848e-06 -1.888e-06 -5.661e-07 1.631e-06 5.982e-06
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.345e-05 1.567e-06 8.583 1.3e-10 ***
## no_of_weeks -2.032e-07 2.129e-07 -0.955 0.34555
## year2020 1.001e-06 2.216e-06 0.452 0.65394
## covid_lockdown -1.241e-05 4.302e-06 -2.884 0.00629 **
## no_of_weeks:year2020 -2.190e-08 3.011e-07 -0.073 0.94239
## year2020:covid_lockdown 1.221e-06 6.084e-06 0.201 0.84196
## no_of_weeks:covid_lockdown 9.431e-07 3.011e-07 3.132 0.00324 **
## no_of_weeks:year2020:covid_lockdown -9.608e-08 4.258e-07 -0.226 0.82260
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.546e-06 on 40 degrees of freedom
## Multiple R-squared: 0.4462, Adjusted R-squared: 0.3492
## F-statistic: 4.603 on 7 and 40 DF, p-value: 0.0007547
#Plot
period_scatter_plot(argentina.urban.NO2,ylim=2.5E-5, xlockdown=12,location="Urban Argentina",date.start="Dec 26th", date.end="June 5th",model=period.model.argentina.urban)#Rural
argentina.rural.NO2 <- NO2.df.filter.fxn("argentina", "rural", as.Date("2019-12-26"), as.Date("2020-06-05"))
#Scatter plot
scatter_gplot(argentina.rural.NO2, 2.5E-5, 12, "Rural Argentina")#Tabulate pollution before and after lockdown
summary(argentina.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-26
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-02-04
## Median :44.00 Mode :character Median :2020-03-16
## Mean :44.00 Mean :2020-03-16
## 3rd Qu.:72.25 3rd Qu.:2020-04-25
## Max. :84.00 Max. :2020-06-05
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :7.740e-06 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:9.803e-06 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :1.097e-05 Median :0.5 Median :0.5
## Mean :1.108e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:1.243e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1.507e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(argentina.rural.NO2$NO2_Concentration[argentina.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 7.740e-06 9.242e-06 9.937e-06 1.012e-05 1.093e-05 1.269e-05
summary(argentina.rural.NO2$NO2_Concentration[argentina.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 8.608e-06 1.101e-05 1.208e-05 1.203e-05 1.315e-05 1.507e-05
#OLS regression
period.model.argentina.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=argentina.rural.NO2)
summary(period.model.argentina.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = argentina.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.451e-06 -8.925e-07 -2.305e-08 5.706e-07 3.076e-06
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.047e-05 6.850e-07 15.289 < 2e-16 ***
## no_of_weeks -1.281e-07 9.307e-08 -1.376 0.176372
## year2020 1.183e-06 9.687e-07 1.221 0.229228
## covid_lockdown -4.964e-06 1.881e-06 -2.639 0.011786 *
## no_of_weeks:year2020 -3.314e-08 1.316e-07 -0.252 0.802472
## year2020:covid_lockdown 1.831e-08 2.660e-06 0.007 0.994541
## no_of_weeks:covid_lockdown 4.748e-07 1.316e-07 3.607 0.000849 ***
## no_of_weeks:year2020:covid_lockdown -1.988e-08 1.861e-07 -0.107 0.915500
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.113e-06 on 40 degrees of freedom
## Multiple R-squared: 0.6325, Adjusted R-squared: 0.5681
## F-statistic: 9.833 on 7 and 40 DF, p-value: 4.574e-07
#Plot
period_scatter_plot(argentina.rural.NO2,ylim=2.5E-5, xlockdown=12,location="Rural Argentina",date.start="Dec 26th", date.end="June 5th",model=period.model.argentina.rural)#Urban
israel.urban.NO2 <- NO2.df.filter.fxn("israel", "urban", as.Date("2019-12-25"), as.Date("2020-06-04"))
#Scatter plot
scatter_gplot(israel.urban.NO2, 5E-5, 12, "Urban Israel")#Tabulate pollution before and after lockdown
summary(israel.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-25
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-02-03
## Median :44.00 Mode :character Median :2020-03-15
## Mean :44.00 Mean :2020-03-15
## 3rd Qu.:72.25 3rd Qu.:2020-04-24
## Max. :84.00 Max. :2020-06-04
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.884e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.769e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :3.179e-05 Median :0.5 Median :0.5
## Mean :3.348e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:3.945e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :5.446e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(israel.urban.NO2$NO2_Concentration[israel.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.413e-05 2.980e-05 3.321e-05 3.553e-05 4.308e-05 4.658e-05
summary(israel.urban.NO2$NO2_Concentration[israel.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.884e-05 2.572e-05 2.996e-05 3.144e-05 3.591e-05 5.446e-05
#OLS regression
period.model.israel.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=israel.urban.NO2)
summary(period.model.israel.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = israel.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.103e-05 -5.496e-06 -1.242e-06 4.708e-06 1.845e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.266e-05 4.670e-06 9.137 2.44e-11 ***
## no_of_weeks -1.070e-06 6.345e-07 -1.687 0.0994 .
## year2020 -1.226e-06 6.604e-06 -0.186 0.8537
## covid_lockdown -2.588e-06 1.282e-05 -0.202 0.8410
## no_of_weeks:year2020 1.332e-07 8.973e-07 0.148 0.8828
## year2020:covid_lockdown -2.619e-05 1.813e-05 -1.444 0.1565
## no_of_weeks:covid_lockdown 7.574e-07 8.973e-07 0.844 0.4036
## no_of_weeks:year2020:covid_lockdown 1.040e-06 1.269e-06 0.820 0.4172
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.587e-06 on 40 degrees of freedom
## Multiple R-squared: 0.2593, Adjusted R-squared: 0.1297
## F-statistic: 2.001 on 7 and 40 DF, p-value: 0.07906
#Plot
period_scatter_plot(israel.urban.NO2,ylim=5E-5, xlockdown=12,location="Urban Israel",date.start="Dec 25th", date.end="June 4th",model=period.model.israel.urban)#Rural
israel.rural.NO2 <- NO2.df.filter.fxn("israel", "rural", as.Date("2019-12-25"), as.Date("2020-06-04"))
#Scatter plot
scatter_gplot(israel.rural.NO2, 5E-5, 12, "Rural Israel")#Tabulate pollution before and after lockdown
summary(israel.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-25
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-02-03
## Median :44.00 Mode :character Median :2020-03-15
## Mean :44.00 Mean :2020-03-15
## 3rd Qu.:72.25 3rd Qu.:2020-04-24
## Max. :84.00 Max. :2020-06-04
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.377e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:1.950e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :2.266e-05 Median :0.5 Median :0.5
## Mean :2.266e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:2.659e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :3.163e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(israel.rural.NO2$NO2_Concentration[israel.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.740e-05 2.206e-05 2.452e-05 2.449e-05 2.769e-05 3.163e-05
summary(israel.rural.NO2$NO2_Concentration[israel.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.377e-05 1.758e-05 2.103e-05 2.084e-05 2.291e-05 2.839e-05
#OLS regression
period.model.israel.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=israel.rural.NO2)
summary(period.model.israel.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = israel.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.289e-06 -2.984e-06 9.570e-08 2.482e-06 7.199e-06
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.748e-05 2.258e-06 12.170 5.02e-15 ***
## no_of_weeks -4.987e-07 3.068e-07 -1.626 0.112
## year2020 -9.529e-08 3.193e-06 -0.030 0.976
## covid_lockdown -7.287e-06 6.199e-06 -1.175 0.247
## no_of_weeks:year2020 9.125e-08 4.339e-07 0.210 0.834
## year2020:covid_lockdown -1.201e-05 8.767e-06 -1.370 0.178
## no_of_weeks:covid_lockdown 5.758e-07 4.339e-07 1.327 0.192
## no_of_weeks:year2020:covid_lockdown 4.796e-07 6.136e-07 0.782 0.439
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.669e-06 on 40 degrees of freedom
## Multiple R-squared: 0.3542, Adjusted R-squared: 0.2412
## F-statistic: 3.134 on 7 and 40 DF, p-value: 0.00981
#Plot
period_scatter_plot(israel.rural.NO2,ylim=5E-5, xlockdown=12,location="Rural Israel",date.start="Dec 25th", date.end="June 4th",model=period.model.israel.rural)#Urban
china.urban.NO2 <- NO2.df.filter.fxn("china", "urban", as.Date("2019-10-31"), as.Date("2020-04-10"))
#Scatter plot
scatter_gplot(china.urban.NO2, 2.5E-4, 12, "Urban China")#Tabulate pollution before and after lockdown
summary(china.urban.NO2)## X Location Period Date
## Min. : 1.00 Length:48 2019:24 Min. :2019-10-31
## 1st Qu.:12.75 Class :character 2020:24 1st Qu.:2019-12-10
## Median :38.50 Mode :character Median :2020-01-19
## Mean :38.50 Mean :2020-01-19
## 3rd Qu.:64.25 3rd Qu.:2020-02-29
## Max. :76.00 Max. :2020-04-10
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :3.746e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:7.752e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :1.033e-04 Median :0.5 Median :0.5
## Mean :1.107e-04 Mean :0.5 Mean :0.5
## 3rd Qu.:1.360e-04 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :2.159e-04 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(china.urban.NO2$NO2_Concentration[china.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 9.981e-05 1.136e-04 1.329e-04 1.433e-04 1.787e-04 2.159e-04
summary(china.urban.NO2$NO2_Concentration[china.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.746e-05 6.291e-05 7.728e-05 7.809e-05 9.174e-05 1.519e-04
#OLS regression
period.model.china.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=china.urban.NO2)
summary(period.model.china.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = china.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.307e-05 -1.154e-05 -2.764e-06 1.008e-05 6.234e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.023e-04 1.496e-05 6.838 3.16e-08 ***
## no_of_weeks 8.551e-06 2.033e-06 4.207 0.000142 ***
## year2020 2.386e-05 2.116e-05 1.128 0.266057
## covid_lockdown 3.620e-05 4.107e-05 0.881 0.383375
## no_of_weeks:year2020 -8.162e-06 2.875e-06 -2.840 0.007068 **
## year2020:covid_lockdown -1.872e-04 5.809e-05 -3.223 0.002523 **
## no_of_weeks:covid_lockdown -1.096e-05 2.875e-06 -3.813 0.000465 ***
## no_of_weeks:year2020:covid_lockdown 1.528e-05 4.065e-06 3.759 0.000545 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.431e-05 on 40 degrees of freedom
## Multiple R-squared: 0.7642, Adjusted R-squared: 0.7229
## F-statistic: 18.52 on 7 and 40 DF, p-value: 9.916e-11
#Plot
period_scatter_plot(china.urban.NO2,ylim=2.5E-4, xlockdown=12,location="Urban China",date.start="Oct 31st",date.end="April 10th",model=period.model.china.urban)#Rural
china.rural.NO2 <- NO2.df.filter.fxn("china", "rural", as.Date("2019-10-31"), as.Date("2020-04-10"))
#Scatter plot
scatter_gplot(china.rural.NO2, 2.5E-4, 12, "Rural China")#Tabulate pollution before and after lockdown
summary(china.rural.NO2)## X Location Period Date
## Min. : 1.00 Length:48 2019:24 Min. :2019-10-31
## 1st Qu.:12.75 Class :character 2020:24 1st Qu.:2019-12-10
## Median :38.50 Mode :character Median :2020-01-19
## Mean :38.50 Mean :2020-01-19
## 3rd Qu.:64.25 3rd Qu.:2020-02-29
## Max. :76.00 Max. :2020-04-10
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.711e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.609e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :3.257e-05 Median :0.5 Median :0.5
## Mean :3.211e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:3.869e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :5.267e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(china.rural.NO2$NO2_Concentration[china.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.021e-05 3.434e-05 3.846e-05 3.855e-05 4.094e-05 5.267e-05
summary(china.rural.NO2$NO2_Concentration[china.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.711e-05 2.155e-05 2.602e-05 2.567e-05 2.955e-05 4.211e-05
#OLS regression
period.model.china.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=china.rural.NO2)
summary(period.model.china.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = china.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.904e-06 -2.823e-06 -1.620e-08 1.862e-06 1.404e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.259e-05 2.903e-06 11.228 6.18e-14 ***
## no_of_weeks 1.035e-06 3.944e-07 2.624 0.01224 *
## year2020 3.621e-06 4.105e-06 0.882 0.38296
## covid_lockdown -2.430e-06 7.970e-06 -0.305 0.76201
## no_of_weeks:year2020 -7.931e-07 5.578e-07 -1.422 0.16281
## year2020:covid_lockdown -3.438e-05 1.127e-05 -3.050 0.00405 **
## no_of_weeks:covid_lockdown -1.105e-06 5.578e-07 -1.982 0.05441 .
## no_of_weeks:year2020:covid_lockdown 2.111e-06 7.888e-07 2.676 0.01075 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.716e-06 on 40 degrees of freedom
## Multiple R-squared: 0.7476, Adjusted R-squared: 0.7034
## F-statistic: 16.92 on 7 and 40 DF, p-value: 3.68e-10
#Plot
period_scatter_plot(china.rural.NO2,ylim=2.5E-4, xlockdown=12,location="Rural China",date.start="Oct 31st",date.end="April 10th",model=period.model.china.rural)#Urban
italy.urban.NO2 <- NO2.df.filter.fxn("italy", "urban", as.Date("2019-12-15"), as.Date("2020-05-25"))
#Scatter plot
scatter_gplot(italy.urban.NO2, 1E-4, 12, "Urban Italy")#Tabulate pollution before and after lockdown
summary(italy.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-15
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-24
## Median :44.00 Mode :character Median :2020-03-05
## Mean :44.00 Mean :2020-03-05
## 3rd Qu.:72.25 3rd Qu.:2020-04-14
## Max. :84.00 Max. :2020-05-25
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.693e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.356e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :3.137e-05 Median :0.5 Median :0.5
## Mean :3.175e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:3.869e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :5.352e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(italy.urban.NO2$NO2_Concentration[italy.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.693e-05 3.140e-05 3.888e-05 3.718e-05 4.238e-05 5.352e-05
summary(italy.urban.NO2$NO2_Concentration[italy.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.756e-05 2.177e-05 2.521e-05 2.632e-05 3.146e-05 3.765e-05
#OLS regression
period.model.italy.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=italy.urban.NO2)
summary(period.model.italy.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = italy.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.780e-05 -4.310e-06 5.130e-08 4.421e-06 1.402e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.396e-05 4.478e-06 7.585 2.91e-09 ***
## no_of_weeks 3.827e-07 6.084e-07 0.629 0.5330
## year2020 1.085e-05 6.333e-06 1.714 0.0943 .
## covid_lockdown 1.696e-05 1.230e-05 1.379 0.1754
## no_of_weeks:year2020 -1.445e-06 8.605e-07 -1.680 0.1008
## year2020:covid_lockdown -2.722e-05 1.739e-05 -1.566 0.1253
## no_of_weeks:covid_lockdown -1.577e-06 8.605e-07 -1.832 0.0744 .
## no_of_weeks:year2020:covid_lockdown 2.058e-06 1.217e-06 1.691 0.0987 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.276e-06 on 40 degrees of freedom
## Multiple R-squared: 0.4878, Adjusted R-squared: 0.3981
## F-statistic: 5.441 on 7 and 40 DF, p-value: 0.0001933
#Plot
period_scatter_plot(italy.urban.NO2,ylim=1E-4, xlockdown=12,location="Urban Italy",date.start="Dec 15th",date.end="May 25th",model=period.model.italy.urban)#Rural
italy.rural.NO2 <- NO2.df.filter.fxn("italy", "rural", as.Date("2019-12-15"), as.Date("2020-05-25"))
#Scatter plot
scatter_gplot(italy.rural.NO2, 1E-4, 12, "Rural Italy")#Tabulate pollution before and after lockdown
summary(italy.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-15
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-01-24
## Median :44.00 Mode :character Median :2020-03-05
## Mean :44.00 Mean :2020-03-05
## 3rd Qu.:72.25 3rd Qu.:2020-04-14
## Max. :84.00 Max. :2020-05-25
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :2.009e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.752e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :3.850e-05 Median :0.5 Median :0.5
## Mean :3.855e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:4.819e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :6.609e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(italy.rural.NO2$NO2_Concentration[italy.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.572e-05 4.272e-05 4.819e-05 4.755e-05 5.223e-05 6.609e-05
summary(italy.rural.NO2$NO2_Concentration[italy.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.009e-05 2.521e-05 2.804e-05 2.956e-05 3.221e-05 4.196e-05
#OLS regression
period.model.italy.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=italy.rural.NO2)
summary(period.model.italy.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = italy.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.959e-05 -3.223e-06 -4.495e-07 4.107e-06 1.600e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.429e-05 4.778e-06 9.269 1.64e-11 ***
## no_of_weeks 5.108e-07 6.492e-07 0.787 0.4360
## year2020 9.980e-06 6.758e-06 1.477 0.1475
## covid_lockdown 1.683e-05 1.312e-05 1.283 0.2068
## no_of_weeks:year2020 -1.555e-06 9.182e-07 -1.693 0.0982 .
## year2020:covid_lockdown -3.071e-05 1.855e-05 -1.655 0.1057
## no_of_weeks:covid_lockdown -2.099e-06 9.182e-07 -2.286 0.0276 *
## no_of_weeks:year2020:covid_lockdown 2.439e-06 1.298e-06 1.879 0.0676 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.764e-06 on 40 degrees of freedom
## Multiple R-squared: 0.6573, Adjusted R-squared: 0.5973
## F-statistic: 10.96 on 7 and 40 DF, p-value: 1.237e-07
#Plot
period_scatter_plot(italy.rural.NO2,ylim=1E-4, xlockdown=12,location="Rural Italy",date.start="Dec 15th",date.end="May 25th",model=period.model.italy.rural)#Urban
iraq.urban.NO2 <- NO2.df.filter.fxn("iraq", "urban", as.Date("2020-01-10"), as.Date("2020-06-20"))
#Scatter plot
scatter_gplot(iraq.urban.NO2, 1E-4, 12, "Urban Iraq")#Tabulate pollution before and after lockdown
summary(iraq.urban.NO2)## X Location Period Date
## Min. : 5.00 Length:48 2019:24 Min. :2020-01-10
## 1st Qu.:16.75 Class :character 2020:24 1st Qu.:2020-02-19
## Median :45.00 Mode :character Median :2020-03-31
## Mean :45.00 Mean :2020-03-31
## 3rd Qu.:73.25 3rd Qu.:2020-05-10
## Max. :85.00 Max. :2020-06-20
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :3.190e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:4.068e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :5.191e-05 Median :0.5 Median :0.5
## Mean :5.072e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:6.054e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :8.106e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(iraq.urban.NO2$NO2_Concentration[iraq.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.190e-05 4.447e-05 5.741e-05 5.512e-05 6.210e-05 8.106e-05
summary(iraq.urban.NO2$NO2_Concentration[iraq.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.222e-05 3.861e-05 4.348e-05 4.633e-05 5.259e-05 6.929e-05
#OLS regression
period.model.iraq.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=iraq.urban.NO2)
summary(period.model.iraq.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = iraq.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.366e-05 -6.167e-06 -1.167e-06 3.590e-06 2.282e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.738e-05 5.326e-06 12.650 1.46e-15 ***
## no_of_weeks -2.127e-06 7.237e-07 -2.940 0.00543 **
## year2020 9.395e-06 7.533e-06 1.247 0.21956
## covid_lockdown -4.468e-05 1.462e-05 -3.055 0.00399 **
## no_of_weeks:year2020 -9.626e-07 1.024e-06 -0.940 0.35262
## year2020:covid_lockdown -2.537e-05 2.068e-05 -1.227 0.22714
## no_of_weeks:covid_lockdown 3.349e-06 1.024e-06 3.272 0.00220 **
## no_of_weeks:year2020:covid_lockdown 1.938e-06 1.447e-06 1.339 0.18806
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.654e-06 on 40 degrees of freedom
## Multiple R-squared: 0.5673, Adjusted R-squared: 0.4916
## F-statistic: 7.493 on 7 and 40 DF, p-value: 9.312e-06
#Plot
period_scatter_plot(iraq.urban.NO2,ylim=1E-4, xlockdown=12,location="Urban Iraq",date.start="Jan 10th",date.end="June 20th",model=period.model.iraq.urban)#Rural
iraq.rural.NO2 <- NO2.df.filter.fxn("iraq", "rural", as.Date("2020-01-10"), as.Date("2020-06-20"))
#Scatter plot
scatter_gplot(iraq.rural.NO2, 1E-4, 12, "Rural Iraq")#Tabulate pollution before and after lockdown
summary(iraq.rural.NO2)## X Location Period Date
## Min. : 5.00 Length:48 2019:24 Min. :2020-01-10
## 1st Qu.:16.75 Class :character 2020:24 1st Qu.:2020-02-19
## Median :45.00 Mode :character Median :2020-03-31
## Mean :45.00 Mean :2020-03-31
## 3rd Qu.:73.25 3rd Qu.:2020-05-10
## Max. :85.00 Max. :2020-06-20
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :1.560e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.168e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :2.692e-05 Median :0.5 Median :0.5
## Mean :2.705e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:3.039e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :4.247e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(iraq.rural.NO2$NO2_Concentration[iraq.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.560e-05 2.429e-05 2.987e-05 2.869e-05 3.312e-05 4.247e-05
summary(iraq.rural.NO2$NO2_Concentration[iraq.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.889e-05 2.158e-05 2.500e-05 2.540e-05 2.850e-05 3.619e-05
#OLS regression
period.model.iraq.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=iraq.rural.NO2)
summary(period.model.iraq.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = iraq.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.563e-06 -2.178e-06 -6.400e-07 2.171e-06 1.118e-05
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.419e-05 2.477e-06 13.801 < 2e-16 ***
## no_of_weeks -1.118e-06 3.366e-07 -3.322 0.001915 **
## year2020 6.842e-06 3.503e-06 1.953 0.057814 .
## covid_lockdown -2.373e-05 6.801e-06 -3.490 0.001193 **
## no_of_weeks:year2020 -5.061e-07 4.760e-07 -1.063 0.293997
## year2020:covid_lockdown -9.709e-06 9.618e-06 -1.009 0.318838
## no_of_weeks:covid_lockdown 1.887e-06 4.760e-07 3.965 0.000295 ***
## no_of_weeks:year2020:covid_lockdown 7.384e-07 6.731e-07 1.097 0.279242
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.025e-06 on 40 degrees of freedom
## Multiple R-squared: 0.6074, Adjusted R-squared: 0.5387
## F-statistic: 8.841 on 7 and 40 DF, p-value: 1.559e-06
#Plot
period_scatter_plot(iraq.rural.NO2,ylim=1E-4, xlockdown=12,location="Rural Iraq",date.start="Jan 10th",date.end="June 20th",model=period.model.iraq.rural)#Urban
india.urban.NO2 <- NO2.df.filter.fxn("india", "urban", as.Date("2019-12-30"), as.Date("2020-06-09"))
#Scatter plot
scatter_gplot(india.urban.NO2, 6E-5, 12, "Urban India")#Tabulate pollution before and after lockdown
summary(india.urban.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-30
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-02-08
## Median :44.00 Mode :character Median :2020-03-20
## Mean :44.00 Mean :2020-03-20
## 3rd Qu.:72.25 3rd Qu.:2020-04-29
## Max. :84.00 Max. :2020-06-09
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :2.698e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:3.533e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :3.775e-05 Median :0.5 Median :0.5
## Mean :3.849e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:4.179e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :5.065e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(india.urban.NO2$NO2_Concentration[india.urban.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.923e-05 3.619e-05 4.034e-05 4.045e-05 4.362e-05 5.065e-05
summary(india.urban.NO2$NO2_Concentration[india.urban.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.698e-05 3.340e-05 3.668e-05 3.653e-05 3.924e-05 4.558e-05
#OLS regression
period.model.india.urban <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=india.urban.NO2)
summary(period.model.india.urban)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = india.urban.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.323e-06 -1.884e-06 -1.551e-07 1.919e-06 6.040e-06
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.019e-05 1.941e-06 25.864 < 2e-16 ***
## no_of_weeks -1.072e-06 2.637e-07 -4.065 0.000218 ***
## year2020 -5.118e-06 2.745e-06 -1.865 0.069577 .
## covid_lockdown -1.901e-05 5.328e-06 -3.569 0.000951 ***
## no_of_weeks:year2020 -6.847e-08 3.729e-07 -0.184 0.855246
## year2020:covid_lockdown 1.342e-06 7.535e-06 0.178 0.859546
## no_of_weeks:covid_lockdown 1.538e-06 3.729e-07 4.125 0.000182 ***
## no_of_weeks:year2020:covid_lockdown -8.147e-08 5.274e-07 -0.154 0.878004
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.153e-06 on 40 degrees of freedom
## Multiple R-squared: 0.72, Adjusted R-squared: 0.671
## F-statistic: 14.69 on 7 and 40 DF, p-value: 2.685e-09
#Plot
period_scatter_plot(india.urban.NO2,ylim=6E-5, xlockdown=12,location="Urban India",date.start="Dec 30th",date.end="June 9th",model=period.model.india.urban)#Rural
india.rural.NO2 <- NO2.df.filter.fxn("india", "rural", as.Date("2019-12-30"), as.Date("2020-06-09"))
#Scatter plot
scatter_gplot(india.rural.NO2, 6E-5, 12, "Rural India")#Tabulate pollution before and after lockdown
summary(india.rural.NO2)## X Location Period Date
## Min. : 4.00 Length:48 2019:24 Min. :2019-12-30
## 1st Qu.:15.75 Class :character 2020:24 1st Qu.:2020-02-08
## Median :44.00 Mode :character Median :2020-03-20
## Mean :44.00 Mean :2020-03-20
## 3rd Qu.:72.25 3rd Qu.:2020-04-29
## Max. :84.00 Max. :2020-06-09
## Week NO2_Concentration covid_lockdown year2020
## Length:48 Min. :2.383e-05 Min. :0.0 Min. :0.0
## Class :character 1st Qu.:2.653e-05 1st Qu.:0.0 1st Qu.:0.0
## Mode :character Median :2.811e-05 Median :0.5 Median :0.5
## Mean :2.844e-05 Mean :0.5 Mean :0.5
## 3rd Qu.:3.027e-05 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :3.405e-05 Max. :1.0 Max. :1.0
## no_of_weeks
## Min. : 1.00
## 1st Qu.: 6.75
## Median :12.50
## Mean :12.50
## 3rd Qu.:18.25
## Max. :24.00
summary(india.rural.NO2$NO2_Concentration[india.rural.NO2$covid_lockdown==0])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.383e-05 2.609e-05 2.796e-05 2.813e-05 2.991e-05 3.344e-05
summary(india.rural.NO2$NO2_Concentration[india.rural.NO2$covid_lockdown==1])## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.435e-05 2.704e-05 2.834e-05 2.876e-05 3.027e-05 3.405e-05
#OLS regression
period.model.india.rural <- lm(NO2_Concentration ~ no_of_weeks*year2020 + covid_lockdown*year2020 + no_of_weeks*covid_lockdown*year2020, data=india.rural.NO2)
summary(period.model.india.rural)##
## Call:
## lm(formula = NO2_Concentration ~ no_of_weeks * year2020 + covid_lockdown *
## year2020 + no_of_weeks * covid_lockdown * year2020, data = india.rural.NO2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.957e-06 -1.352e-06 -1.575e-07 1.396e-06 3.867e-06
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.108e-05 1.231e-06 25.245 <2e-16 ***
## no_of_weeks -1.497e-07 1.673e-07 -0.895 0.3762
## year2020 -4.211e-06 1.741e-06 -2.419 0.0202 *
## covid_lockdown 9.775e-07 3.380e-06 0.289 0.7739
## no_of_weeks:year2020 4.117e-08 2.366e-07 0.174 0.8627
## year2020:covid_lockdown 1.774e-06 4.780e-06 0.371 0.7125
## no_of_weeks:covid_lockdown 7.531e-08 2.366e-07 0.318 0.7519
## no_of_weeks:year2020:covid_lockdown -1.176e-07 3.345e-07 -0.352 0.7270
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2e-06 on 40 degrees of freedom
## Multiple R-squared: 0.5503, Adjusted R-squared: 0.4716
## F-statistic: 6.993 on 7 and 40 DF, p-value: 1.879e-05
#Plot
period_scatter_plot(india.rural.NO2,ylim=6E-5, xlockdown=12,location="Rural India",date.start="Dec 30th",date.end="June 9th",model=period.model.india.rural)